package Chapter.chapter19;

public class Student implements Comparable<Student> {
    private String id;
    private String name;
    private int score;

    public Student(String id, String name, int score) {
        this.id = id;
        this.name = name;
        this.score = score;
    }

    @Override
    public String toString() {
        return "\n" + "Student_score{" + "id：" + id + ", name：" + name + ", score：" + score + '}' + "\n";
    }

    @Override
    public int compareTo(Student o) {
        if (score > o.score) {
            return 1;
        } else if (score < o.score) {
            return -1;
        } else {
            return 0;
        }
    }
}